package com.xinqi.modules.course.image.client;

import com.xinqi.common.base.constants.ServiceNameConstants;
import com.xinqi.common.base.response.PageInfo;
import com.xinqi.common.base.response.R;
import com.xinqi.modules.course.image.dto.req.CourseImageCreateDTO;
import com.xinqi.modules.course.image.dto.req.CourseImageQueryDTO;
import com.xinqi.modules.course.image.dto.req.CourseImageUpdateDTO;
import com.xinqi.modules.course.image.dto.rsp.CourseImageResultDTO;
import com.xinqi.modules.course.image.factory.CourseImageFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 课程背景封面图表客户端
 *
 * @author: system
 * @date: 2023/03/22
 */
@FeignClient(value = ServiceNameConstants.XQ_COURSE, fallbackFactory = CourseImageFallbackFactory.class)
public interface CourseImageClient {

    /**
     * 课程背景封面图表-分页
     */
    @GetMapping("/course-image/page")
    R<PageInfo<CourseImageResultDTO>> page(CourseImageQueryDTO dto);

    /**
     * 课程背景封面图表-详情
     */
    @GetMapping("/course-image/{id}")
    R<CourseImageResultDTO> findById(@PathVariable("id") Long id);

    /**
     * 新增课程背景封面图表
     */
    @PostMapping("/course-image")
    R<Long> insert(@RequestBody CourseImageCreateDTO dto);

    /**
     * 修改课程背景封面图表
     */
    @PutMapping("/course-image/{id}")
    public R<Boolean> update(@PathVariable("id") Long id, @RequestBody CourseImageUpdateDTO dto);

    /**
     * 删除课程背景封面图表
     */
    @DeleteMapping("/course-image/{id}")
    R<Boolean> delete(@PathVariable("id") Long id);

}
